package com.ipzoe.app.controller;

import com.ipzoe.common.core.domain.AjaxResult;
import com.ipzoe.common.core.domain.entity.SysDictData;
import com.ipzoe.system.service.ISysDictDataService;
import com.ipzoe.system.service.ISysDictTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api("数据字典相关")
@RestController
@RequestMapping("api/v1/dict")
@Validated
public class DictController {

    @Autowired
    private ISysDictDataService iSysDictDataService;

    @Autowired
    private ISysDictTypeService iSysDictTypeService;

    @ApiOperation("获取某字典类型的字典列表")
    @GetMapping("/list/{dictType}")
    public AjaxResult listDictData(@PathVariable String dictType){

        List<SysDictData> dictDataList = iSysDictTypeService.selectDictDataByType(dictType);
        return AjaxResult.success(dictDataList);
    }

}
